package com.cloudshadow.platform.server.common.base.model;

import org.springframework.data.domain.Page;

import java.util.List;

public class PageModel<T extends BaseModel>{

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 1L;

	public PageModel(org.springframework.data.domain.Page<T> page) {
		this.dataList = page.getContent();
		this.page = page.getNumber() + 1;
		this.total = page.getTotalElements();
	}

	public PageModel() {

	}

	private List<T> dataList;

	private Integer page;

	private Long total;

	public List<T> getDataList() {
		return dataList;
	}

	public void setDataList(List<T> dataList) {
		this.dataList = dataList;
	}

	public Integer getPage() {
		return page;
	}

	public void setPage(Integer page) {
		this.page = page;
	}

	public Long getTotal() {
		return total;
	}

	public void setTotal(Long total) {
		this.total = total;
	}

}
